home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / menuge.zip / MENUGEN.DOC < prev    next >
Text File  |  1990-12-19  |  6KB  |  151 lines

  1.  
  2.  
  3.  
  4.                         MenuGen Version 1.0
  5.  
  6.                 Menu and Status Line Generator for
  7.  
  8.                 Borland's Turbo Pascal 6.0(R) with
  9.  
  10.                         TurboVision(R)
  11.  
  12.                 (C) Copyright 1990 by Vernon J. Adams
  13.                         All Rights Reserved
  14.  
  15.         Further copyright information given below
  16.  
  17.  
  18.      INTRODUCTION
  19.  
  20.      The enclosed program is a simple  compiler  designed  to  ease  the
  21.      coding  of menu entries and status line entries.  I found that when
  22.      I looked at the TurboVision Manual the routines to build a menu and
  23.      a  status  line  were  daunting   at   best   (All   those   nested
  24.      parentheses!!).   So,  rather  than count nesting levels, I wrote a
  25.      simple compiler to take a keyword driven specification of the  menu
  26.      and  status  entries and then generate the Pascal code to build the
  27.      menus.  That's what  the  enclosed  program  does.   It  accepts  a
  28.      specification language and creates Pascal code.
  29.  
  30.      The  language  to  specify the menu and status lines is simple.  It
  31.      consists of keywords followed by the arguments  to  the  procedures
  32.      calls you would make in Pascal.
  33.  
  34.  
  35.  
  36.      REQUIREMENTS
  37.  
  38.      Borland's Turbo Pascal(R) version 6.0
  39.      Some familiarity with the Turbo Vision package
  40.  
  41.  
  42.      The following files are supplied:
  43.  
  44.         MENUGEN.EXE         The Menu-Status Line Generator program
  45.         TESTMENU.MDF        The Sample Menu-Status Line Specification
  46.         TESTMENU.PAS        The output of a generation of the sample
  47.         MENUGEN.DOC         This file
  48.  
  49.  
  50.      TO GENERATE MENU-STATUS LINE CODE
  51.  
  52.         MENUGEN input-file output-file
  53.  
  54.                 input-file is the Menu-Status Line Specification
  55.                 output-file is the pascal generated from the
  56.                                 specification
  57.  
  58.  
  59.      A sample specification follows:
  60.  
  61.         APPLICATION TMApp
  62.         MENU MyMenu
  63.                 SUBMENU ~F~ile
  64.                         ITEM ~O~pen F3 kbF3 cmFileOpen
  65.                         ITEM ~N~ew F4 kbF4 cmNewWin
  66.                         SEPARATOR
  67.                         ITEM E~x~it Alt-X kbAltX cmQuit
  68.                 SUBMENU ~W~indow
  69.                         ITEM ~N~ext F6 kbF6 cmNext
  70.                         ITEM ~Z~oom F5 kbF5 cmZoom
  71.                         ITEM ~D~ialog F2 kbF2 cmNewDialog
  72.         STATUS StatLine
  73.                 KEY "~Alt-X~ Exit" kbAltX cmQuit
  74.                 KEY "~F4~ New" kbF4 cmNewWin
  75.                 KEY "~Alt-F3~ Close" kbAlt3 cmClose
  76.  
  77.      Let's  look  at  the  sample  to  get  a feel for the specification
  78.      language. First, all whitespace is equal; the indentations are  for
  79.      reading clarity only.  Second, all the keywords are capitalized for
  80.      the  same  reason,  kewords  do  not  need  to  be capitalized.  An
  81.      argument only needs to be quoted if it  contains  whitespace.   The
  82.      names  after  the  MENU  and STATUS keywords are optional since the
  83.      Application object contains variables to  hold  these  items.   The
  84.      name  after  the APPLICATION keyword is the name of the Application
  85.      object type.
  86.  
  87.      This example along  with  the  discussions  in  the  TurboVision(R)
  88.      Manual  should  give  you a good idea of how the program works.  It
  89.      just a straight forward generation  of  the  code  to  relieve  the
  90.      program from the tedium of counting parentheses.
  91.  
  92.  
  93.      Now for a formal definition of the specification language.
  94.  
  95.         MenuStatusSpec    := ApplicationHeader  MenuSpec StatusSpec
  96.         ApplicationHeader := APPLICATION  [ApplicationName]
  97.         MenuSpec          := MenuHeader  SubMenuSpec*
  98.         MenuHeader        := MENU [MenuName]
  99.         SubMenuSpec       := SubMenuHeader  ItemSeparatorSpec*
  100.         SubMenuHeader     := SUBMENU SubMenuText
  101.         ItemSepartorSpec  := ItemSpec   |   SeparatorSpec
  102.         SeparatorSpec     := SEPARATOR
  103.         ItemSpec          := ITEM ItemLabel HotKeyLabel HotKey Command
  104.  
  105.         StatusSpec        := StatusHeader KeySpec
  106.         StatusHeader      := STATUS [StatusBarName]
  107.         KeySpec           := KEY KeyLabel HotKey Command
  108.  
  109.  
  110.      Keywords can be upper or lower case.  Specifications can  be  split
  111.      across lines.
  112.  
  113.      Please  note: This generator is not particularly robust in handling
  114.      errors.  It was designed  as  a  quick  convenience  for  bypassing
  115.      tedious  coding.   If  a  specification  does  not  compile  or the
  116.      generator objects, compare that specification with the example  and
  117.      grammar   above   and   compare   it   with  the  examples  in  the
  118.      TurboVision(R) Manual.
  119.  
  120.      Combined with L. David Baldwin's DLGDSN(C), this program  should  make
  121.      creating TurboVision(R) programs much simpler.
  122.  
  123.  
  124.      COPYRIGHT
  125.  
  126.      Documentation  and  Program  (C) Copyright 1990 by Vernon J. Adams.
  127.      All Rights Reserved.
  128.  
  129.      Other  brand  and  product  names  are  trademarks  or   registered
  130.      trademarks of their respective holders.
  131.  
  132.      MENUGEN may be copied and  distributed  freely  by  individuals  to
  133.      friends  and  acquaintances  providing  that no fee is charged with
  134.      the exception of a reasonable handling and distribution fee and  it
  135.      is  not  part  of a package for which a charge is made.  The output
  136.      from MENUGEN may be used freely for any legal purpose.
  137.  
  138.      Also please report any problems, suggestions, etc.
  139.  
  140.  
  141.      You may contact me by Compuserve or at the addresses below.
  142.  
  143.      Vernon J. Adams
  144.      CompuServe ID #71201,63.
  145.  
  146.      5927 Western Hills Dr.
  147.      Norcross, GA  30071
  148.  
  149.  
  150.  
  151.